package com.young.coordin.server.util;

import com.young.coordin.server.model.CoordinResultEnum;
import com.young.interfaces.coordin.model.CoordinResponse;

/**
 * Created by Admin on 2021/3/27.
 */
public class CoordinResponseBuilder {

    /**
     * 成功注册
     * @param version
     * @return
     */
    public static CoordinResponse buildSuccess(long version) {
        CoordinResponse registerResponse = new CoordinResponse();
        registerResponse.setCode(CoordinResultEnum.SUCCESS.code());
        registerResponse.setInfo(CoordinResultEnum.SUCCESS.info());
        registerResponse.setVersion(version);
        return registerResponse;
    }

    /**
     * 注册失败
     * @param coordinResultEnum
     * @return
     */
    public static CoordinResponse buildFail(CoordinResultEnum coordinResultEnum) {
        CoordinResponse registerResponse = new CoordinResponse();
        registerResponse.setCode(coordinResultEnum.code());
        registerResponse.setInfo(coordinResultEnum.info());
        return registerResponse;
    }

    /**
     * 注册失败
     * @param code
     * @param info
     * @return
     */
    public static CoordinResponse buildFail(Integer code, String info) {
        CoordinResponse registerResponse = new CoordinResponse();
        registerResponse.setCode(code);
        registerResponse.setInfo(info);
        return registerResponse;
    }
}
